<?php
namespace app\admin\controller;
use think\Db;
class Agree extends Base
{
    public function user(){
        if(request()->isPost ()){
            extract (input());
            $res = Db::name('jifen_conf')->where('conf_id',9)->update (['conf_rate'=>$html,'conf_time'=>date('Y-m-d H:i:s')]);
            if($res){
                return json(['code'=>200,'msg'=>'保存成功']);
            }else{
                return json(['code'=>100,'msg'=>'保存失败']);
            }
        }
        $data = Db::name('jifen_conf')->where('conf_id',9)->value ('conf_rate');
        return $this->fetch('agree/user',['data'=>$data]);
    }


    public function shop(){
        if(request()->isPost ()){
            extract (input());
            $res = Db::name('jifen_conf')->where('conf_id',10)->update (['conf_rate'=>$html,'conf_time'=>date('Y-m-d H:i:s')]);
            if($res){
                return json(['code'=>200,'msg'=>'保存成功']);
            }else{
                return json(['code'=>100,'msg'=>'保存失败']);
            }
        }
        $data = Db::name('jifen_conf')->where('conf_id',10)->value ('conf_rate');
        return $this->fetch('agree/shop',['data'=>$data]);
    }

    public function privacy(){
        if(request()->isPost ()){
            extract (input());
            $res = Db::name('jifen_conf')->where('conf_id',25)->update (['conf_rate'=>$html,'conf_time'=>date('Y-m-d H:i:s')]);
            if($res){
                return json(['code'=>200,'msg'=>'保存成功']);
            }else{
                return json(['code'=>100,'msg'=>'保存失败']);
            }
        }
        $data = Db::name('jifen_conf')->where('conf_id',25)->value ('conf_rate');
        return $this->fetch('agree/privacy',['data'=>$data]);
    }
}